import Vue from 'vue';
import Vuex from 'vuex';

Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    city: '武汉'
  },
  actions: {
    clickCity(ctx, item) {
      ctx.commit('changeCitys', item)
    }
  },
  mutations: {
    changeCitys(state, item) {
      state.city = item
    }
  },
  getters:{
      city(state){
        return state.city + '1'
      },
      dualcity(state){
          return `${state.city} 111 ${state.city}`
      }
  }
})

// 分流
// import state from './state';
// import actions from './actions';
// import mutations from './mutations';
// import getters from './getters';
// export default new Vuex.Store({
//   state,
//   actions,
//   mutations,
//   getters
// })
